<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Add Transportation</title>
    </h:head>
    <h:body>
        <h:form id="form1">
            <center>Transportation Service Type</center>
            <br/>
            <center>Name: <h:inputText value="#{TSTBean.TSTName}" /></center>   

            <h:outputText value="#{TSTBean.error}"/>
            <br/>
            <h:outputText id="out" value="#{TSTBean.getShowAttributesAdded()}"/>

            <p:dataTable id="tbl" var="varr" editable="true" paginator="true" rows="10" value="#{TSTBean.TSattributeTypes}">
                <p:ajax event="rowEdit" listener="#{TSTBean.onEdit}"/>
                <p:ajax event="rowEditCancel" listener="#{TSTBean.onCancel}" />


                <p:column headerText="Value" style="width:25%">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{varr.value}" />
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{varr.value}" style="width:100%"/>
                        </f:facet>
                    </p:cellEditor>
                </p:column>


                <p:column headerText="Name" style="width:25%">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{varr.attributeType.name}" />
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{varr.attributeType.name}" style="width:100%"/>
                        </f:facet>
                    </p:cellEditor>
                </p:column>

                <p:column style="width:6%">
                    <p:rowEditor />
                </p:column>


            </p:dataTable> 
            <br/>
            <center>      
                Attribute Name:
                <h:selectOneMenu value="#{TSTBean.attributeId}" id="selectt">
                    <f:selectItems value="#{attributebean.attributeTypes}" var="att"
                                   itemLabel="#{att.name}" itemValue="#{att.id}" />
                </h:selectOneMenu>

            Value:  <h:inputText id="valuee" value="#{TSTBean.attValue}" />
            <p:commandButton value="Add Attribute" update=":form1:tb1"/>
                <!--<f:ajax execute="valuee selectt"  render="out"/>-->
            </center>
            <br/>
            <br/>
            <center>  <p:commandButton  value="Add TransportationServiceType" type="submit"  action="#{TSTBean.getAddTransServ}" /></center>
        </h:form>
    </h:body>
</html>
